var newsTable;
function getcRateOrderList() {
    if (typeof newsTable !== 'undefined') {
        newsTable.fnPageChange('first');
        return;
    }
    var i = 1;
    newsTable = $("#cRateOrderList").DataTable({
        "sAjaxSource": _path + "/cRateOrder/queryByPage",          
        "fnServerParams": function (aoData) {
            aoData.push(
            	{ "name": "createTime", "value": $("#fromDate").val()+","+$("#toDate").val()},
                { "name": "productxid", "value": $("#productxid").val() },

                {"name": "name" ,"value":$("#name").val()}
            );
        },
        "sServerMethod": "POST",
        "sAjaxDataProp": "dataList",
        "fnCreatedRow": function () {
            i++;
        },
        "fnPreDrawCallback": function () {
            i = 1;
        },
        "aoColumns": [
            { "sTitle": "序号", "sWidth": "2%",
                "mData": function () {
                    return i;
                }
            },    
            { "sTitle": "订单号", "mData": "orderNo", "sWidth": "10%" },
            { "sTitle": "用户名", "mData": "username", "sWidth": "10%" },
            { "sTitle": "商品", "mData": "productxname", "sWidth": "10%" },
            { "sTitle": "订单时间", "mData": "createTime", "sWidth": "10%" },
            { "sTitle": "订单金额", "mData": "total", "sWidth": "10%" },
            { "sTitle": "转租操作时间", "mData": "cztime", "sWidth": "10%" },
            {
				"sTitle" : "支付状态",
				"mData" : "zfStatus",
				"sWidth" : "6%",
				"mRender" : function(data) {
					var chatType = '';
					switch (data) {
					case '0':
						chatType = '未支付';
						break;
					case '1':
						chatType = '<span  style="color: #FF4040;">已支付<span>';
						break;
					case '4':
						chatType = '<span  style="color: #66cccc;">转租中<span>';
						break;
				 
					}
					return chatType;
				}
			},
            { "sTitle": "操作", "sWidth": "10%",
                "mData": function (data) {
                    var status = '<a href="' + _path + '/cRateOrder/edit/' + data.id + '" class="btn default btn-xs purple"><i class="fa fa-edit" title="编辑"></i></a>';
                    status += '<a href="' + _path + '/cRateOrder/del/' + data.id + '"  class="btn default btn-xs red"><i class="fa fa-trash-o" title="删除"></i></a>';
                    return status;
                }
            }
        ]
    });
    

}


